<%@ include file="../init.jsp" %>

<%@ page import="java.util.List" %>
<%@ page import="uit.edu.vn.portal.elearning.models.announcement.Announcement" %>
<%@ page import="uit.edu.vn.portal.elearning.logic.SakaiWSLogic" %>
<%@ page import="uit.edu.vn.portal.elearning.helper.SakaiWSHelper" %>
<%@ page import="java.util.Date" %>
<%
	List<Announcement> announcements = (List<Announcement>)request.getAttribute("annoucements");
	String sakaiurl = application.getInitParameter("sakai.server.url");
	SakaiWSLogic logic = (SakaiWSLogic)request.getAttribute("logic");
%>
<table>
<tr>
	<th><liferay-ui:message key="announcement-subject" /></th>
	<th><liferay-ui:message key="announcement-date" /></th>
	<th><liferay-ui:message key="announcement-body" /></th>
	<th><liferay-ui:message key="announcement-course" /></th>
</tr>
<% 
	for(Announcement announcement:announcements ){ 
		Date time = new Date(announcement.getTime());
		String linktosakai = sakaiurl + announcement.getPageUrl();
		String site_title = SakaiWSHelper.getSiteTitle(logic,announcement.getSiteid());
%>
<tr>
	<td width="20%"><a href="<%= linktosakai %>"><%= announcement.getSubject()%></a></td>
	<td width="15%"><%= time.toGMTString() %></td>
	<td width="35%"><%= announcement.getBody()%></td>
	<td width="30%"><a href="<%= linktosakai %>"><%= site_title%></a></td>
</tr>
<% } %>
</table> 


